package com.xdtech.forum.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.sql.Timestamp;

import com.xdtech.core.orm.utils.BeanUtils;
import com.xdtech.forum.model.CommentInfo;
import com.xdtech.forum.model.LinkTag;
import com.xdtech.web.freemark.item.GridColumn;

/**
 * 
 * @author max.zheng
 * @create 2015-03-06 16:52:46
 * @since 1.0
 * @see
 */
public class CommentInfoItem implements Serializable{
	private static final long serialVersionUID = 1L;
	private Long id;
	@GridColumn(title="内容",width=250)
	private String content;
	@GridColumn(title="评论人",width=100)
	private String memberName;
	@GridColumn(title="评论时间",width=150)
	private Date createTime;

	public void setId(Long id) {
		this.id = id;
	}
	public Long getId() {
		return id;
	}
	
	public void setContent(String content) {
		this.content = content;
	}
	public String getContent() {
		return content;
	}
	public String getMemberName() {
		return memberName;
	}
	public void setMemberName(String memberName) {
		this.memberName = memberName;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	/**
	 * 根据model构建vo
	 * 
	 * @author <a href="max.zheng@zkteco.com">郑志雄</>
	 * @since 2015-3-6 下午3:08:13
	 * @param linkTag
	 * @return
	 */
	public static CommentInfoItem createItem(CommentInfo commentInfo) {
		CommentInfoItem commentInfoItem = new CommentInfoItem();
		BeanUtils.copyProperties(commentInfoItem, commentInfo);
		commentInfoItem.setMemberName(commentInfo.getMember().getName());
		return commentInfoItem;
	}
	/**
	 * 根据model集合创建vo集合
	 * 
	 * @author max.zheng
	 * @create 2015-3-6下午10:30:21
	 * @modified by
	 * @param commentInfos
	 * @return
	 */
	public static List<CommentInfoItem> createItems(List<CommentInfo> commentInfos) {
		List<CommentInfoItem> commentInfoItems = new ArrayList<CommentInfoItem>();
		for (CommentInfo commentInfo : commentInfos) {
			commentInfoItems.add(createItem(commentInfo));
		}
		return commentInfoItems;
	}
}
